var http = require('../http.js')
//发送验证码
const send = (mobile) => {
  var url = 'sms/send'
  http.config.loadtext = '发送中...'
  return http.getReq(url, {
    mobile: mobile,
    event: 'mobilelogin'
  })
}

const check = (mobile, captcha) => {
  var url = 'sms/check'
  http.config.isload = false
  return http.getReq(url, {
    mobile: mobile,
    event: 'mobilelogin',
    captcha: captcha
  })
}
// 手机验证码登录
const mobilelogin = (data) => {
  var url = 'user/mobilelogin';
  http.config.loadtext = '登录中...'
  return http.postReq(url, data)
}
//微信登录返回sessionkey
const wx_login = (js_code) => {
  var url = 'user/wx_login'
  http.config.isload = false;

  return http.getReq(url, {
    js_code: js_code
  })
}
// 微信小程序获取手机号直接登录会员

const wx_mobilelogin = (data) => {
  var url = 'user/wx_mobilelogin'
  http.config.loadtext = '登录中...'
  return http.getReq(url, data)
}

module.exports = {
  send,
  check,
  mobilelogin,
  wx_login,
  wx_mobilelogin,
}